package de.hhbk.azubiverwaltung.business.beans;

import java.lang.reflect.ParameterizedType;

public abstract class GenericBBean<I,B> {

	protected I dao;
	
	@SuppressWarnings({ "unchecked"})
	public GenericBBean()
	{
		Class<B> beanClazz = (Class<B>)
                ((ParameterizedType)getClass()
                .getGenericSuperclass())
                .getActualTypeArguments()[1];

		try 
		{
			dao = (I) beanClazz.newInstance();
		} 
		catch (InstantiationException e) 
		{
			e.printStackTrace();
		} 
		catch (IllegalAccessException e) 
		{
			e.printStackTrace();
		}
	}
}
